/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.business.domain.sup;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import me.zhengjie.base.BaseBusiness;
import me.zhengjie.business.domain.Pggs;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

/**
* @website https://el-admin.vip
* @description /
* @author xiahongbo
* @date 2022-04-11
**/
@Entity
@Data
@Table(name="BIS_RYGL")
@Embeddable
@Inheritance(strategy=InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "BIS_RYGL_RYLX", discriminatorType = DiscriminatorType.STRING)
public class Rygl extends BaseBusiness implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "RyglSeqGenerator")
    @SequenceGenerator(name = "RyglSeqGenerator", sequenceName = " SEQUENCE_USER", allocationSize = 1)
    @Column(name = "BIS_RYGL_ID")
    @ApiModelProperty(value = "人员管理ID")
    private Long bisRyglId;

    @Column(name = "BIS_RYGL_USER_ID")
    @ApiModelProperty(value = "系统用户ID")
    private Long bisRyglUserId;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "BIS_RYGL_DW")
    @ApiModelProperty(value = "单位ID")
    @JSONField(serialize = false)
    @ToString.Exclude
    private Gsgl gsgl;

    @Column(name = "BIS_RYGL_XM")
    @ApiModelProperty(value = "姓名")
    private String bisRyglXm;

    @Column(name = "BIS_RYGL_XB")
    @ApiModelProperty(value = "性别")
    private String bisRyglXb;

    @Column(name = "BIS_RYGL_LXDH")
    @ApiModelProperty(value = "联系电话")
    private String bisRyglLxdh;

    @Column(name = "BIS_RYGL_ZJLX")
    @ApiModelProperty(value = "证件类型")
    private String bisRyglZjlx;

    @Column(name = "BIS_RYGL_ZJHM")
    @ApiModelProperty(value = "证件号码")
    private String bisRyglZjhm;

    @Column(name = "BIS_RYGL_YBQH")
    @ApiModelProperty(value = "医保区划")
    private String bisRyglYbqh;

    @Column(name = "BIS_RYGL_YHDL")
    @ApiModelProperty(value = "银行大类")
    private String bisRyglYhdl;

    @Column(name = "BIS_RYGL_KHHMC")
    @ApiModelProperty(value = "开户行名称")
    private String bisRyglKhhmc;

    @Column(name = "BIS_RYGL_KHHID")
    @ApiModelProperty(value = "开户行ID")
    private String bisRyglKhhid;

    @Column(name = "BIS_RYGL_YHZH")
    @ApiModelProperty(value = "银行账户")
    private String bisRyglYhzh;

    @Column(name = "BIS_RYGL_YHHM")
    @ApiModelProperty(value = "银行户名")
    private String bisRyglYhhm;

    @Column(name = "BIS_RYGL_JJ")
    @ApiModelProperty(value = "简介")
    private String bisRyglJj;

    @Column(name = "BIS_RYGL_RYLX", insertable = false, updatable = false)
    @ApiModelProperty(value = "人员类型")
    private String bisRyglRylx;

    public void copy(Rygl source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
    @Override
    public int hashCode() {
        return Objects.hash(bisRyglId, bisRyglZjhm);
    }
}